<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */

/**
 * This class is able to render Xml views.
 */
class FW_View_Xml extends FW_View_Abstract
{
	/**
	 * @var DOMDocument The XML DOM document.
	 */
	private $dom;

    /**
     * Initializes a new instance of this class.
	 * @param DOMDocument $dom The DOMDocument to use.
     */
    public function __construct(DOMDocument $dom)
    {
		$this->dom = $dom;
    }

    /**
     * Renders the view to the screen.
     * @param FW_Controller_Action $controller The controller that wants the rendering to be done.
     * @param string $actionName The name of the action that wants the rendering to be done.
     */
    public function render(FW_Controller_Action $controller, $actionName)
    {
        header('content-type: application/xml');
        echo $this->dom->saveXML();
    }
}
